package com.yootk.lifecycle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.stereotype.Component;

@Component
public class MessageBean implements InitializingBean, SmartInitializingSingleton {
    private static final Logger LOGGER = LoggerFactory.getLogger(MessageBean.class) ;
    public MessageBean(){
        LOGGER.info("构造方法--MessageBean{},实例化MessageBean对象");
    }
    @Override
    public void afterPropertiesSet() throws Exception {
        LOGGER.info("【InitializingBean--afterPropertiesSet】MessageBean的初始化配置操作");

    }

    @Override
    public void afterSingletonsInstantiated() {
        LOGGER.info("【SmartInitializingSingleton--afterSingletonsInstantiated】MessageBean初始化完成后，采用单例模式");

    }
}
